<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>HELLO Index</h1>

    <script>
      const baseURL = "http://127.0.0.1:8090/api/collections";

      const xhr = new XMLHttpRequest();
      xhr.open("POST", `${baseURL}/todolist/records`);

      /* response */
      xhr.responseType = "json";
      // 成功响应 200 ok
      xhr.onload = function () {
        console.log(xhr.response);
      };

      /* request */
      xhr.setRequestHeader("Content-Type", "application/json");
      xhr.send(JSON.stringify({ title: "hahaha", status: "2" }));
    </script>
  </body>
</html>
